//
//  HLHomeController.m
//  app.home
//
//  Created by 胡林虎 on 2017/6/26.
//  Copyright © 2017年 胡林虎. All rights reserved.
//

#import "HLHomeController.h"
#import <GFRouter/GFRouter.h>
#import <app_utils/app_utils.h>
#import <app_infor/app_infor.h>
#import <YYKit/YYCache.h>

@interface HLHomeController ()

@end

@implementation HLHomeController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor yellowColor];
//
    [[GFRouter shared] map:@"/info/InforSub" toControllerClass:NSClassFromString(@"InforSubController")];
    
    [[NSUserDefaults standardUserDefaults] setObject:@"HH" forKey:@"123"];
    [[NSUserDefaults standardUserDefaults] synchronize];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(notification) name:@"123" object:nil];
    
    
    
    UILabel *slable = [HLControl createLabelWithFrame:CGRectMake(30, 100, kScreenWidth-30*2, 80)  text:@"首页控件"  textAlignment:NSTextAlignmentCenter fontSize:35 textColor:[UIColor whiteColor]  bgColor:[UIColor blueColor]  cornerRadius:5 tag:0 tapAction:^{
        NSLog(@"btn -- click ");
        
        HLInforController *infor = [[HLInforController alloc] init];
        [infor setInforSection];
    }];
    
   [self.view addSubview:slable];
    
    
}
     
-(void)notification {
 
     NSLog(@" 接受到了");
 }

-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    
    [[GFRouter shared] matchController:@"/info/InforSub" paramDict:nil];
    
    
    YYCache *yyCache = [[YYCache alloc] initWithName:@"HLSpace"];
    [yyCache setObject:@"yyCache" forKey:@"homePage"];
    
    

//    [self requestNatData];

}
-(void)requestNatData {

    [GFNetWorkControl requestURLWithToast:@"http://localhost/PHP/index.php?name=Hoolink" hostType:1 parmas:nil cacheTimeInSeconds:1 needToast:YES requestSuccess:^(id result) {
        NSLog(@"result ------ %@",result);
    } requestFailed:^(id result) {
        NSLog(@"result ------ %@",result);
        
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
